#ifndef UDPRECEIVOR_H
#define UDPRECEIVOR_H

#include <QObject>
#include <QUdpSocket>

/* qt 不能直接绑定到网卡，指定ip即绑定对应ip的网卡上了 */

class UdpReceivor : public QObject
{
    Q_OBJECT

public:
    UdpReceivor(QString ip, int port, QObject *p = 0);
    ~UdpReceivor();

    void startRecv();
    QByteArray& getRecvBuffer();

signals:
    void signal_getUdpDataReady();



private slots:
    void receive();

private:
    QString ip;
    int port;
    QUdpSocket *uSocket;

    QByteArray read_buffer;

};

#endif // UDPRECEIVOR_H
